/**
 * 定义一个函数readFilePromise封装promise对象异步读文件
 */
const fs = require('fs')
const readFilePromise = ()=>{
const promise = new Promise(function(resolve,reject){
    fs.readFile('old.txt','utf-8',(err,data)=>{
        if(err){
            reject('读文件出错');
            return
        }
        resolve(data.toString);
    })
})
    return promise
}

module.exports = {
    readFilePromise
}


//暴露readFilePromise